\hypertarget{interface_tic_tac_opponent}{
\section{TicTacOpponent Class Reference}
\label{interface_tic_tac_opponent}\index{TicTacOpponent@{TicTacOpponent}}
}


The computer's logic \hyperlink{interface_tic_tac_opponent}{TicTacOpponent} is the computer opponent. It is expected the controller will properly notify the opponent when it's his turn.  


{\ttfamily \#import $<$TicTacOpponent.h$>$}\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
(void) -\/ \hyperlink{interface_tic_tac_opponent_a9790f588df697446986d360384c5d100}{setPlayerCode:}
\begin{DoxyCompactList}\small\item\em Sets the player code (TICTAC\_\-X or TICTAC\_\-O) for the opponent. \item\end{DoxyCompactList}\item 
(void) -\/ \hyperlink{interface_tic_tac_opponent_ac752f6e14c65763615de0678c7938dee}{setSkillLevel:}
\begin{DoxyCompactList}\small\item\em Sets the skill level of the opponent. \item\end{DoxyCompactList}\item 
(void) -\/ \hyperlink{interface_tic_tac_opponent_ada72cebfed5b3b0bf2b3cc70bab07fd7}{takeTurn:}
\begin{DoxyCompactList}\small\item\em The main method expected to be invoked from the controller. This will let the computer take a turn. \item\end{DoxyCompactList}\item 
(BOOL) -\/ \hyperlink{interface_tic_tac_opponent_aee29213593c481f6a2f5c166dd3e7a3a}{makeWinningDecisionXOut:yOut:}
\begin{DoxyCompactList}\small\item\em Used internally, do not call directly. Call takeTurn instead. \item\end{DoxyCompactList}\item 
(BOOL) -\/ \hyperlink{interface_tic_tac_opponent_a526770c9b21667c09c8d430ee4d5d877}{makeBlockingDecisionXOut:yOut:}
\begin{DoxyCompactList}\small\item\em Used internally, do not call directly. Call takeTurn instead. \item\end{DoxyCompactList}\item 
(BOOL) -\/ \hyperlink{interface_tic_tac_opponent_a99a5e828495ad65eb6085f2f3199a1e2}{makeStrategicDecisionXOut:yOut:}
\begin{DoxyCompactList}\small\item\em Used internally, do not call directly. Call takeTurn instead. \item\end{DoxyCompactList}\item 
(BOOL) -\/ \hyperlink{interface_tic_tac_opponent_a8b95db9d4b657d7abf8e221017af09d6}{makeRandomDecisionXOut:yOut:}
\begin{DoxyCompactList}\small\item\em Used internally, do not call directly. Call takeTurn instead. \item\end{DoxyCompactList}\item 
(BOOL) -\/ \hyperlink{interface_tic_tac_opponent_a1205334575875f79c0fc280400d2be6a}{makeDesperateDecisionXout:yOut:}
\begin{DoxyCompactList}\small\item\em Used internally, do not call directly. Call takeTurn instead. \item\end{DoxyCompactList}\item 
(void) -\/ \hyperlink{interface_tic_tac_opponent_a5af8d1b88255a86a459a316b8f5001fa}{setModel:}
\begin{DoxyCompactList}\small\item\em Sets the data model to use for analysis. It is expected somebody else will own the model. \item\end{DoxyCompactList}\item 
(void) -\/ \hyperlink{interface_tic_tac_opponent_a34c634fa7242147b41975e4170d14274}{getPositionsOtherThan:outOtherA:outOtherB:}
\begin{DoxyCompactList}\small\item\em Helper method expected to be used internally. In 0,1,2 it will return the other two numbers that are different than the value put in. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{interface_tic_tac_opponent_a756a91e7a9bb51e507f41b373a7526b1}{player}
\item 
int \hyperlink{interface_tic_tac_opponent_a9101f9b99a6c07a5122ea8114e7181f3}{skillLevel}
\item 
\hyperlink{interface_tic_tac_model}{TicTacModel} $\ast$ \hyperlink{interface_tic_tac_opponent_acbb00572f544c904076e39b825c0086e}{model}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
The computer's logic \hyperlink{interface_tic_tac_opponent}{TicTacOpponent} is the computer opponent. It is expected the controller will properly notify the opponent when it's his turn. 

\subsection{Member Function Documentation}
\hypertarget{interface_tic_tac_opponent_a34c634fa7242147b41975e4170d14274}{
\index{TicTacOpponent@{TicTacOpponent}!getPositionsOtherThan:outOtherA:outOtherB:@{getPositionsOtherThan:outOtherA:outOtherB:}}
\index{getPositionsOtherThan:outOtherA:outOtherB:@{getPositionsOtherThan:outOtherA:outOtherB:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{getPositionsOtherThan:outOtherA:outOtherB:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) getPositionsOtherThan: (int) {\em inCheck}\/ outOtherA: (int$\ast$) {\em a}\/ outOtherB: (int$\ast$) {\em b}}}
\label{interface_tic_tac_opponent_a34c634fa7242147b41975e4170d14274}


Helper method expected to be used internally. In 0,1,2 it will return the other two numbers that are different than the value put in. 
\begin{DoxyParams}{Parameters}
\item[{\em inCheck}]The input number \item[{\em a}]first output \item[{\em b}]second output \end{DoxyParams}
\hypertarget{interface_tic_tac_opponent_a526770c9b21667c09c8d430ee4d5d877}{
\index{TicTacOpponent@{TicTacOpponent}!makeBlockingDecisionXOut:yOut:@{makeBlockingDecisionXOut:yOut:}}
\index{makeBlockingDecisionXOut:yOut:@{makeBlockingDecisionXOut:yOut:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{makeBlockingDecisionXOut:yOut:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (BOOL) makeBlockingDecisionXOut: (int$\ast$) {\em x}\/ yOut: (int$\ast$) {\em y}}}
\label{interface_tic_tac_opponent_a526770c9b21667c09c8d430ee4d5d877}


Used internally, do not call directly. Call takeTurn instead. 
\begin{DoxyParams}{Parameters}
\item[{\em x}]the output x position if it made a decision \item[{\em y}]the output y position if it made a decision \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Whether or not it was successfull is making a decision. Logic checks to see if it can block the other player. 
\end{DoxyReturn}
\hypertarget{interface_tic_tac_opponent_a1205334575875f79c0fc280400d2be6a}{
\index{TicTacOpponent@{TicTacOpponent}!makeDesperateDecisionXout:yOut:@{makeDesperateDecisionXout:yOut:}}
\index{makeDesperateDecisionXout:yOut:@{makeDesperateDecisionXout:yOut:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{makeDesperateDecisionXout:yOut:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (BOOL) makeDesperateDecisionXout: (int$\ast$) {\em x}\/ yOut: (int$\ast$) {\em y}}}
\label{interface_tic_tac_opponent_a1205334575875f79c0fc280400d2be6a}


Used internally, do not call directly. Call takeTurn instead. 
\begin{DoxyParams}{Parameters}
\item[{\em x}]the output x position if it made a decision \item[{\em y}]the output y position if it made a decision \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Whether or not it was successfull is making a decision. Last resort. Ideally should never be called, however random is... random and there is no guarantee that a decision can be made randomly before it reaches the sanity check. 
\end{DoxyReturn}
\hypertarget{interface_tic_tac_opponent_a8b95db9d4b657d7abf8e221017af09d6}{
\index{TicTacOpponent@{TicTacOpponent}!makeRandomDecisionXOut:yOut:@{makeRandomDecisionXOut:yOut:}}
\index{makeRandomDecisionXOut:yOut:@{makeRandomDecisionXOut:yOut:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{makeRandomDecisionXOut:yOut:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (BOOL) makeRandomDecisionXOut: (int$\ast$) {\em x}\/ yOut: (int$\ast$) {\em y}}}
\label{interface_tic_tac_opponent_a8b95db9d4b657d7abf8e221017af09d6}


Used internally, do not call directly. Call takeTurn instead. 
\begin{DoxyParams}{Parameters}
\item[{\em x}]the output x position if it made a decision \item[{\em y}]the output y position if it made a decision \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Whether or not it was successfull is making a decision. As the name implies, makes a completely random decision. 
\end{DoxyReturn}
\hypertarget{interface_tic_tac_opponent_a99a5e828495ad65eb6085f2f3199a1e2}{
\index{TicTacOpponent@{TicTacOpponent}!makeStrategicDecisionXOut:yOut:@{makeStrategicDecisionXOut:yOut:}}
\index{makeStrategicDecisionXOut:yOut:@{makeStrategicDecisionXOut:yOut:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{makeStrategicDecisionXOut:yOut:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (BOOL) makeStrategicDecisionXOut: (int$\ast$) {\em x}\/ yOut: (int$\ast$) {\em y}}}
\label{interface_tic_tac_opponent_a99a5e828495ad65eb6085f2f3199a1e2}


Used internally, do not call directly. Call takeTurn instead. 
\begin{DoxyParams}{Parameters}
\item[{\em x}]the output x position if it made a decision \item[{\em y}]the output y position if it made a decision \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Whether or not it was successfull is making a decision. Checks to see if it can make strategic decision. 
\end{DoxyReturn}
\hypertarget{interface_tic_tac_opponent_aee29213593c481f6a2f5c166dd3e7a3a}{
\index{TicTacOpponent@{TicTacOpponent}!makeWinningDecisionXOut:yOut:@{makeWinningDecisionXOut:yOut:}}
\index{makeWinningDecisionXOut:yOut:@{makeWinningDecisionXOut:yOut:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{makeWinningDecisionXOut:yOut:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (BOOL) makeWinningDecisionXOut: (int$\ast$) {\em x}\/ yOut: (int$\ast$) {\em y}}}
\label{interface_tic_tac_opponent_aee29213593c481f6a2f5c166dd3e7a3a}


Used internally, do not call directly. Call takeTurn instead. 
\begin{DoxyParams}{Parameters}
\item[{\em x}]the output x position if it made a decision \item[{\em y}]the output y position if it made a decision \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Whether or not it was successfull is making a decision. Logic checks to see if it can make a winning decision. 
\end{DoxyReturn}
\hypertarget{interface_tic_tac_opponent_a5af8d1b88255a86a459a316b8f5001fa}{
\index{TicTacOpponent@{TicTacOpponent}!setModel:@{setModel:}}
\index{setModel:@{setModel:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{setModel:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) setModel: ({\bf TicTacModel}$\ast$) {\em currentModel}}}
\label{interface_tic_tac_opponent_a5af8d1b88255a86a459a316b8f5001fa}


Sets the data model to use for analysis. It is expected somebody else will own the model. 
\begin{DoxyParams}{Parameters}
\item[{\em currentModel}]The data model to use \end{DoxyParams}
\hypertarget{interface_tic_tac_opponent_a9790f588df697446986d360384c5d100}{
\index{TicTacOpponent@{TicTacOpponent}!setPlayerCode:@{setPlayerCode:}}
\index{setPlayerCode:@{setPlayerCode:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{setPlayerCode:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) setPlayerCode: (int) {\em playerCode}}}
\label{interface_tic_tac_opponent_a9790f588df697446986d360384c5d100}


Sets the player code (TICTAC\_\-X or TICTAC\_\-O) for the opponent. 
\begin{DoxyParams}{Parameters}
\item[{\em playerCode}]TICTAC\_\-X or TICTAC\_\-O \end{DoxyParams}
\hypertarget{interface_tic_tac_opponent_ac752f6e14c65763615de0678c7938dee}{
\index{TicTacOpponent@{TicTacOpponent}!setSkillLevel:@{setSkillLevel:}}
\index{setSkillLevel:@{setSkillLevel:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{setSkillLevel:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) setSkillLevel: (int) {\em skill}}}
\label{interface_tic_tac_opponent_ac752f6e14c65763615de0678c7938dee}


Sets the skill level of the opponent. 
\begin{DoxyParams}{Parameters}
\item[{\em skill}]0 means weaker skill, 100 means more difficult. \end{DoxyParams}
\hypertarget{interface_tic_tac_opponent_ada72cebfed5b3b0bf2b3cc70bab07fd7}{
\index{TicTacOpponent@{TicTacOpponent}!takeTurn:@{takeTurn:}}
\index{takeTurn:@{takeTurn:}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{takeTurn:}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (void) takeTurn: (NSError$\ast$$\ast$) {\em error}}}
\label{interface_tic_tac_opponent_ada72cebfed5b3b0bf2b3cc70bab07fd7}


The main method expected to be invoked from the controller. This will let the computer take a turn. 
\begin{DoxyParams}{Parameters}
\item[{\em error}]Allow an error code if the computer cannot take a turn properly. \end{DoxyParams}


\subsection{Member Data Documentation}
\hypertarget{interface_tic_tac_opponent_acbb00572f544c904076e39b825c0086e}{
\index{TicTacOpponent@{TicTacOpponent}!model@{model}}
\index{model@{model}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{model}]{\setlength{\rightskip}{0pt plus 5cm}-\/ ({\bf TicTacModel}$\ast$) {\bf model}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_opponent_acbb00572f544c904076e39b825c0086e}
A reference to the data model used while analyzing. This model is not owned by the opponent, it expects somebody else to own it. \hypertarget{interface_tic_tac_opponent_a756a91e7a9bb51e507f41b373a7526b1}{
\index{TicTacOpponent@{TicTacOpponent}!player@{player}}
\index{player@{player}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{player}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (int) {\bf player}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_opponent_a756a91e7a9bb51e507f41b373a7526b1}
The code for the opponent player. Could be TICTAC\_\-X or TICTAC\_\-O \hypertarget{interface_tic_tac_opponent_a9101f9b99a6c07a5122ea8114e7181f3}{
\index{TicTacOpponent@{TicTacOpponent}!skillLevel@{skillLevel}}
\index{skillLevel@{skillLevel}!TicTacOpponent@{TicTacOpponent}}
\subsubsection[{skillLevel}]{\setlength{\rightskip}{0pt plus 5cm}-\/ (int) {\bf skillLevel}\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{interface_tic_tac_opponent_a9101f9b99a6c07a5122ea8114e7181f3}
Any value between 0 and 100 where 0 implies an easier opponent, and 100 implies a harder component. 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
TicTacOpponent.h\item 
TicTacOpponent.m\end{DoxyCompactItemize}
